<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
  {
    const arr = [1,2,3]
    arr.reduce((p,x)=>{
      return p.then(()=>{
        return new Promise(r=>{
          setTimeout(()=>{
            console.log(x)
            r()
          },1000)
        })
      })
    },Promise.resolve())
  }
  {
    function delay(ms){
      return new Promise(r=>{
        setTimeout(()=>{
          r()
        },ms)
      })
    }
    async function start(){
      let arr = [1,2,3]
      for(let i = 0;i < arr.length;i++){
        await delay(1000)
        console.log(arr[i])
      }
    }
    start()
  }
</script>
</html>
